有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Java小程序未在HTML中显示

这是我的小程序。它工作得很好。它显示小程序中的所有内容

import java.applet.Applet;   // Imports the Applet class
import java.awt.Graphics;    // Imports the Graphics class, used to draw lines, circles, squares, text, etc

/** 
* The HelloWorldApplet class implements an applet that simply displays "Hello World!". 
*/ 

// Our HelloWorldApplet class extends  the Applet class, giving it access to all the methods of Applet.
public class HelloWorldApplet extends Applet
{         

// The paint method draws anything that is in our applet on the applet screen.  
// It takes a graphics object (g), that is used to draw

public void paint(Graphics screen) 
{     
    // drawString is a method of the Graphics class.  It takes a string, and two integer parameters 
    // as x and y coordinates.  These coordinates correspond to Quadrant I of a traditional coordinate
    // plane, so they are always positive.         
    screen.drawString("Hello World Applet", 50, 30);
    screen.drawString("Sikki Nixx", 50, 60);
    screen.drawString("What was yesterday's date?", 50, 90);
    screen.drawString(printAmerican(), 50, 120);
}

public String printAmerican() {
    return ("Thursday" + ", " + "October" + " " + 15 + ", " + 2015 + ".");
}
}

这就是我的HTML,但网页上什么也没有显示。有人能帮我弄清楚吗

<HTML>
<BODY>
<APPLET CODE=HelloWorldApplet.class WIDTH=200 HEIGHT=100>
</APPLET>
</BODY>
</HTML>

共 (0) 个答案